Can't create prepared statement for invalid database connection (Error 40015)

The program tried to create an rdoPreparedStatement or rdoQuery object on an invalid rdoConnection.

To avoid this problem, make sure the rdoConnection object is currently connected to a data source.